import java.util.Scanner;

public class day230511 {
    // 最长上升子序列
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = in.nextInt();
            }

            // 存放第i个元素结尾, 最长的上升序列
            int[] dp = new int[n];
            // 初始化
            dp[0] = 1;
            // for (int i = 0; i < n; i++) {
            //     dp[i] = 1;
            // }
            int max = 1;
            // 从第二个元素开始
            for (int i = 1; i < n; i++) {
                // 最长子序列最少为 1
                dp[i] = 1;
                for (int j = 0; j < i; j++) {
                    if (arr[i] > arr[j]) {
                        dp[i] = Math.max(dp[i], dp[j] + 1);
                    }
                }
                // 更新结果
                max = Math.max(dp[i], max);
            }
            System.out.println(max);
        }
    }

    // 发邮件
    // 与上次的年会抽奖一样
    // 递归
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {
            int n = sc.nextInt();
            System.out.println(count(n));
        }
    }

    private static long count(int n) {
        if (n == 1) {
            return 0;
        }
        if (n == 2) {
            return 1;
        }
        return (n - 1) * (count(n - 1) + count(n - 2));
    }

    // 动归
    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();
            long[] dp = new long[n + 1];
            dp[1] = 0;
            dp[2] = 1;
            for (int i = 3; i <= n; i++) {
                dp[i] = (i - 1) * (dp[i - 1] + dp[i - 2]);
            }
            System.out.println(dp[n]);
        }
    }
}
